import http from "@/utils/http";
import {GW} from "@/common/const";
const href = window.location.href;
const matchb = href.match(/token=([A-Za-z0-9,_.]{1,})/);
const matcha = href.match(/productId=(\d+)/);
var _token = matchb ? matchb[1] : "";
var _id = matcha ? matcha[1] : "";
var productId = window.localStorage.getItem("productId");
var id = _id || productId;
/*
 * 通过条件查询统计营业部详情-席位掘金 (姚)
 * 
 */
export function getBranch(option) {
  const url = `${GW}/gw/ynstockinfo/client/hero/branch/stat/detail`;
  const params = {
    ...option,
  };
  return http.get(url,  params);
}
/**
 * 查询上榜股票统计详情-个股透视 (姚)
 */
export function getStock(option) {
  const url = `${GW}/gw/ynstockinfo/client/hero/stock/stat/detail`;
  const params = {
    ...option,
  };
  return http.get(url,  params );
}

/**
 * 查询上榜股票统计某个交易日营业部上榜数据 (姚)
 */
export function getStockList(option) {
  const url = `${GW}/gw/ynstockinfo/client/hero/stock/stat/branch/list`;
  const params = {
    ...option,
  };
  return http.get(url, params );
}


/**
 * 最新交易日时间列表 (姚)
 */
export function getTimeList(option) {
  const url = `${GW}/gw/ynstockinfo/client/hero/date/list`;
  const params = {
    ...option,
  };
  return http.get(url,  params);
}

/**
 * 关注/取消关注 (姚)
 */
export function save(option) {
  const url = `${GW}/gw/ynstockinfo/client/hero/attention/save.htm`;
  const params = {
    ...option,
  };
  return http.post(url,params);
}
/**
 * 用户关注-关注状态 (姚)
 */
export function attention(option) {
  const url = `${GW}/gw/ynstockinfo/client/hero/attention/info.htm`;
  const params = {
    ...option,
  };
  return http.get(url, params );
  
}

/**
 * 查询上榜股票统计某个交易日营业部上榜数据 (姚)
 */
 export function stockList(option) {
  const url = `${GW}/gw/ynstockinfo/client/hero/stock/list`;
  const params = {
    ...option,
  };
  return http.get(url, params);
}
